package com.weiqk.pmdemo.dao;

import com.weiqk.pmdemo.pojo.ApplyLink;
import com.weiqk.pmdemo.pojo.Dic;
import com.weiqk.pmdemo.pojo.PayLink;
import com.weiqk.pmdemo.pojo.PurchaseLink;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface PayLinkRepostitory extends PagingAndSortingRepository<PayLink,Integer> {
    @Query(value = "select * FROM PM_PAY_LINK where PURCHASE_ID=:n",nativeQuery = true)
    List<PayLink> findOneById(@Param("n") int id);
    @Query(value = "select * FROM PM_PAY_LINK" +
            " where COMPLETE_FLAG=1 " +
            "AND  purchase_id=:n " +
            "ORDER BY COMPLETE_DATE DESC",nativeQuery = true)
    List<PayLink> findfirstPay(@Param("n") int id);
}
